<?php
$s['AddHead'] = '
<script language="JavaScript" src="'.base_url().'jsc/mem/jquery-1.3.2.min.js" type="text/javascript"></script>';
$s['AddTitle']= "View profile";
$s['AddHeadJquery'] = '';
//init user status list
$tmpx = '<select name="updatenewstatus" id="updatenewstatus">';
$tmplist = $this->member->SetUserStatus(0);
foreach($tmplist as  $k => $v){
	if($k == $profile['memsystem']['userstatus']){
		$tmpx .= '<option value="'.$k.'" selected="selected">'.$v.'</option>';
	}
	else
	{
		$tmpx .= '<option value="'.$k.'">'.$v.'</option>';
	}
}
$tmpx .= "</select>";

//click to change status
$s['AddHeadJquery'] .= '
$("#show-status2").hide();
$("#show-status").css({"cursor":"pointer","background-color":"#FFFF66"});
<!-- click to change status -->
$("#show-status").click(function () { 
			$("#show-status").hide();
			$("#show-status2").show();
			$("#edit-status").hide();

    });';

//change status
$s['AddHeadJquery'] .= '
<!-- change status -->
$("#updatenewstatus").change(function () { 
	$.post("'.base_url().'mem/admin/updatestatus/'.$this->uri->segment(4).'", { act_value: $("#updatenewstatus").val()},
		function(data){
			$("#show-status").empty();
			$("#show-status2").hide();
			$("#edit-status").show();
			$("#show-status").append(data);
			$("#show-status").show();
		} );
    });';
	
//click to change userrank
$s['AddHeadJquery'] .= '
$("#update-rank").hide();
$("#show-rank").css({"cursor":"pointer","background-color":"#FFFF66"});
<!-- click to change status -->
$("#show-rank").click(function () { 
			$("#show-rank").hide();
			$("#update-rank").show();


    });';

//change status
$s['AddHeadJquery'] .= '
<!-- change status -->
$("#updaterank").change(function () { 
	$.post("'.base_url().'mem/admin/updaterank/'.$this->uri->segment(4).'", { act_value: $("#updaterank").val()},
		function(data){
			$("#show-rank").empty();
			$("#update-rank").hide();
			$("#show-rank").append(data);
			$("#show-rank").show();
		} );
    });';
$this->load->view('mem/a_header',$s);
$this->load->view('mem/a_panel_v');
?>
<table id="viewprofile" width="80%">
<caption>Member Profile</caption>

<tr>
	<td>
	<table id="systemuser" width="100%">
		<tr>
			<td rowspan="5" width="200px"><!-- img-->
			<?php
			if($cf['p_avatar'] && strlen($profile['memprofile']['p_avatar'])> 10){
				echo '<img src="'.base_url().'upload/memupload/'.$profile["memprofile"]["p_avatar"].'" title="avatar" />';
			}
			else
			{
				echo "no avatar";
			}
			?></td>
			<td>Username : <?=$profile['memsystem']['username']?></td>
		</tr>
		<tr>
			<td>Email : <?=$profile['memsystem']['email']?></td>
		</tr>
		<tr>
			<td>Signup : <?=$profile['memprofile']['signupdate']?></td>
		</tr>
		<tr>
			<td>Status : <span id="show-status"><?=$this->member->SetUserStatus($profile['memsystem']['userstatus'])?></span><span id="show-status2"><?=$tmpx?></span></td>
		</tr>
		<tr>
			<td>Class : <span id="show-rank"><?=$this->member->SetUserRank($profile['memsystem']['userrank'])?></span><span id="update-rank">
				<?php
				$tmpx = $this->member->SetUserRank(0);
				$selectlist = '<select name="updaterank" id="updaterank">';
				foreach($tmpx as $k => $v){
					if($k == $profile['memsystem']['userrank']){
						$selectlist .= '<option value="'.$k.'" selected="selected">'.$v.'</option>';
					}
					else
					{
						$selectlist .= '<option value="'.$k.'">'.$v.'</option>';
					}
					
				}
				$selectlist .= '</select>';
				echo $selectlist;
				?>
			</span></td>
		</tr>
	</table>
	</td>
</tr>
<tr>
	<td>
	<?php
	echo $this->member->showProfile($profile,FALSE);
	?>
	</td>
</tr>

	</table>
<?php
$this->load->view('mem/a_footer');
?>